﻿@using Covenant.Models
@using Covenant.Models.Covenant
@using Covenant.Models.Grunts
@using Microsoft.AspNetCore.Identity
@inject CovenantContext CovContext
@inject UserManager<CovenantUser> UserManager
@model IEnumerable<GruntTasking>

<div class="table-responsive">
    <table id="tasking-table" class="table table-hover">
        <thead>
            <tr>
                <th>@Html.DisplayNameFor(model => model.Name)</th>
                <th>@Html.DisplayNameFor(model => model.Grunt)</th>
                <th>Task</th>
                <th>@Html.DisplayNameFor(model => model.Status)</th>
                <th>@Html.DisplayNameFor(model => model.GruntCommand.User.UserName)</th>
                <th>@Html.DisplayNameFor(model => model.GruntCommand.Command)</th>
                <th>@Html.DisplayNameFor(model => model.GruntCommand.CommandTime)</th>
                <th>@Html.DisplayNameFor(model => model.CompletionTime)</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                <tr>
                    <td>
                        <a asp-controller="GruntTasking" asp-action="Interact" asp-route-id="@item.Id">
                            @Html.DisplayFor(modelItem => item.Name)
                        </a>
                    </td>
                    <td>
                        <a asp-controller="Grunt" asp-action="Interact" asp-route-id="@item.GruntId">
                            @Html.DisplayFor(modelItem => item.Grunt.Name)
                        </a>
                    </td>
                    <td>
                        <a asp-controller="GruntTask" asp-action="Edit" asp-route-id="@item.GruntTaskId">
                            @Html.DisplayFor(modelItem => item.GruntTask.Name)
                        </a>
                    </td>
                    <td>@item.Status</td>
                    <td>
                        <a asp-controller="CovenantUser" asp-action="Edit" asp-route-id="@item.GruntCommand.User.Id">
                            @Html.DisplayFor(modelItem => item.GruntCommand.User.UserName)
                        </a>
                    </td>
                    <td>@Html.DisplayFor(modelItem => item.GruntCommand.Command)</td>
                    <td>@Html.DisplayFor(modelItem => item.GruntCommand.CommandTime)</td>
                    <td>@Html.DisplayFor(modelItem => item.CompletionTime)</td>
                </tr>
            }
        </tbody>
    </table>
</div>